package com.training.io.stream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

public class StreamDemo {
	public static void main(String[] args) throws Exception {
		InputStream in = new FileInputStream("C:\\Users\\10146\\Desktop\\program\\music\\因为爱情.mp3");
		OutputStream out = new FileOutputStream("C:\\Users\\10146\\Desktop\\program\\因为爱情.mp3");
		
//		int n = 0 ;
		
		long s1 = System.currentTimeMillis();
		
		
		byte[] buffer = new byte[1026];//缓存
		
		System.out.println("文件开始拷贝...");
		while((in.read(buffer))!=-1) {
//			out.write(n);
			out.write(buffer);
		}
		long s2 = System.currentTimeMillis();
		System.out.println(s2-s1+"ms");
		
		out.close();
		in.close();
	}

}
